package com.android.jump;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;

import android.graphics.Bitmap;

public class Animation 
{
		
     private Vector<Bitmap> mvBitmaps;
     private int mCurrentBitmap;
     
     Animation()
     {
    	 mCurrentBitmap = 0;
    	 mvBitmaps = new Vector<Bitmap>();
    	 Timer timer = new Timer();
    	 MyTask timetask = new MyTask();
    	 timer.schedule(timetask, 500,500);

     }
     
     public void addBitmap(Bitmap nBitmap)
     {mvBitmaps.add(nBitmap);}
     
     public void setCurBitmap()
     {
    	 mCurrentBitmap++;
    		 if(mCurrentBitmap>=mvBitmaps.size())
    			 {mCurrentBitmap = 0;}
     }
     
     public boolean isEmpty()
     {return mvBitmaps.isEmpty();}
     
     public Bitmap getCurBitmap()
     {return mvBitmaps.get(mCurrentBitmap);}
     
     public class MyTask extends TimerTask{
    	 public void run() {
    		 setCurBitmap(); 
    	 }
    	 }

}
